﻿<html>
<head>
<title>QQ你懂的</title>
<hta:application
	applicationname="htanotepad" id="ohta" border="thick"
	borderstyle="normal" caption="yes" contextmenu="yes"
	innerborder="no" maximizebutton="yes" minimizebutton="yes"
	navigable="yes"
	icon="notepad.exe" scroll="no" scrollflat="no"
	selection="no" showintaskbar="yes" singleinstance="no"
	sysmenu="yes" version="0.3" windowstate="normal"/>
<script src="Common.js"></script>
<script src="Local.js"></script>
<style type="text/css">
body{margin:0;font-family:"宋体";font-size:12px;}
#textarea_editor{width:100%;height:100%;}
table,td,tr{width:100%;height:100%;}
.setting{height:25px;}
#text_path{width:500px;}
</style>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" scroll="no">
<table colspan="0" rowspan="0">
	<tr><td class="setting">
		SafeBase路径：<input id="text_path" title="本地目录" readonly="readonly"/>
	</td></tr>
	<tr><td class="setting">
		<input id="button_process" type="button"/>
	</td></tr>
	<tr><td>
		<textarea id="textarea_editor" wrap="off"></textarea>
	</td><tr>
</table>
<script>
Common.setEvent(window, "load", function() {
	var shell = new ActiveXObject("WScript.Shell");
	var safeBase = shell.SpecialFolders("AppData") + "\\tencent\\QQ\\SafeBase";
	Common.$("text_path").value = safeBase;
	shell = null;
	
	({
		doChange: function() {
			if (Local.fileExists(safeBase)) { // 已经被替换成文件
				Common.$("button_process").value = "恢复SafeBase";
			} else {
				if (Local.folderExists(safeBase))
					Common.$("button_process").value = "屏蔽SafeBase";
				else {
					Common.$("button_process").value = "没装QQ？";
				}
			}
		},
		init: function() {
			var self = this;
			Common.$("button_process").onclick = function() {
				if (Local.fileExists(safeBase)) {
					Local.deleteFile(safeBase);
					Local.moveFolder(safeBase + "_bak", safeBase);
				} else {
					if (Local.folderExists(safeBase)) {
						Local.moveFolder(safeBase, safeBase + "_bak");
						Local.setFileText(safeBase, "");
					}
				}
				self.doChange();
			};
			this.doChange();
		}
	}).init();
});
</script>
</body>
</html>